package org.gwt.project.tools.quickfix;

import org.eclipse.core.resources.IMarker;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
import org.eclipse.ui.IMarkerResolutionGenerator2;

public class Container implements IMarkerResolutionGenerator, IMarkerResolutionGenerator2 {

	@Override
	public IMarkerResolution[] getResolutions(IMarker marker) {
		
		// Create QuickFix description message
		String name = marker.getResource().getName();
		String folder = marker.getResource().getParent().getFullPath().toString();
		String msg = "Remove library '" + name + "' from '" + folder + "'";
		
		// Finished  
		return new IMarkerResolution[]{
			new RemoveResource(msg)
		};
	}

	@Override
	public boolean hasResolutions(IMarker marker) {
		return marker.getAttribute(Generator.PROBLEM_ID, "").equals(Generator.CONTAINER);
	}
}